package danli;

public class Singleton {
	
	private volatile static Singleton uniqueInstance;
	
	private Singleton() {
		
	}
	
	public	static synchronized Singleton getInstance() {
		if(null == uniqueInstance) {
			uniqueInstance = new Singleton();
		}
		return uniqueInstance;
	}
	
	public	static Singleton getInstance1() {
		if(null == uniqueInstance) {
			synchronized (Singleton.class) {
				uniqueInstance = new Singleton();
			}
		}
		return uniqueInstance;
	}

}
